int max(int a, int b){return a>b?a:b;}
int min(int a, int b){return a<b?a:b;}

int maxProfit(int* prices, int pricesSize)
{
    int idx = 0, idm = prices[0];
    for(int i = 0; i < pricesSize; i++)
    {
        idm = min(idm, prices[i]);
        idx = max(idx, prices[i] - idm);

    }
    return idx;
}